package com.gitee.wsl.android.ui.spannable.span

import android.text.style.RelativeSizeSpan

class HeaderSpan(proportion: Float,var level:Int) : RelativeSizeSpan(proportion) {

    companion object{
        protected val HEADER_SIZES = floatArrayOf(1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f)
        val Header1:HeaderSpan get() = HeaderSpan(HEADER_SIZES[0],1)
        val Header2:HeaderSpan get() = HeaderSpan(HEADER_SIZES[1],2)
        val Header3:HeaderSpan get() = HeaderSpan(HEADER_SIZES[2],3)
        val Header4:HeaderSpan get() = HeaderSpan(HEADER_SIZES[3],4)
        val Header5:HeaderSpan get() = HeaderSpan(HEADER_SIZES[4],5)
        val Header6:HeaderSpan get() = HeaderSpan(HEADER_SIZES[5],6)

        fun header(level: Int):HeaderSpan{
            if(level in 1..6)
                return HeaderSpan(HEADER_SIZES[level-1],level)
            return Header3
        }
    }
}